import java.util.Locale;
import java.util.Scanner;

public class Test {

    public static void main(String[] args) {
        int sum = 1;
        Scanner scan = new Scanner(System.in);
        System.out.print("str = ");
        String str = scan.nextLine();
        str = str.trim();//清除字符串两边的空格
        for (int i = 0; i < str.length(); i++) {
            if (str.charAt(i) == ' ') {
                sum++;
            }
        }
        System.out.println(sum);
    }

    public static void main2(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("str = ");
        String[] str = scan.nextLine().split(" ");
        System.out.println(str.length);
    }

    public static void main1(String[] args) {
        Scanner scan = new Scanner(System.in);
        System.out.print("s = ");
        String s = scan.nextLine();
        System.out.println(s.toLowerCase());
    }
}
